<template>
  <div class="modal fade"
       id="selfDeptPermissionModal"
       tabindex="-1"
       role="dialog"
       aria-labelledby="roleAuthorizedModel"
       aria-hidden="true">
    <div class="modal-dialog"
         style="width: 800px;">
      <div class="modal-content"
           style="margin-top: 25px;">
        <div class="modal-header">
          <button type="button"
                  class="close"
                  @click="closeWindow">
            <span aria-hidden="true">&times;</span>
            <span class="sr-only">Close</span>
          </button>
          <h4 class="modal-title"
              id="myModalLabel">
            机构数据权限【{{bindPartnerInfo.partnerName}}】
          </h4>
        </div>
        <div style="padding: 10px;padding-bottom: 0;">
          <selfDeptPermission ref="selfDeptPermission"
                              :bindPartnerInfo="bindPartnerInfoNew"
                              :dialogShow="dialogShow"
                              @closeWindow="closeWindow" />
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import selfDeptPermission from "./selfDeptPermission.vue";
export default {
  props: {
    bindPartnerInfo: {
      type: Object,
      default: {},
    },
  },
  data() {
    return {
      dialogShow: false,
      bindPartnerInfoNew: {},
    };
  },
  components: {
    selfDeptPermission,
  },
  watch: {
    bindPartnerInfo: {
      handler(v) {
        this.bindPartnerInfoNew = v;
        if (v.partnerId !== 0) {
          this.dialogShow = true;
        }
      },
      deep: true,
    },
  },
  methods: {
    closeWindow() {
      $("#selfDeptPermissionModal").modal("hide");
      this.bindPartnerInfoNew.partnerId = 0;
      this.dialogShow = false;
    },
  },
};
</script>

<style scoped>
</style>